package com.example.demo.controller;

import com.example.demo.service.AsyncService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class AsyncController {
    @Autowired
    private AsyncService asyncService;


    @GetMapping("/run-tasks")
    public String runTasks() {
        for (int i = 0; i < 10; i++) {
            asyncService.executeTask(i);
        }
        return "Tasks started!";
    }
}